package ua.com.minus1.lookbattle.utils;

import android.os.Bundle;

/**
 * Created with IntelliJ IDEA.
 * User: Igorek
 * Date: 8/9/12
 * Time: 10:36 PM
 * To change this template use File | Settings | File Templates.
 */
public class BundleCreator {

    private static final String CAT_ID = "catId";
    private static final String LOOK_ID = "lookId";
    private static final String BONUSES = "bonuses";
    private static final String POSITION = "position";
    private static final String IMAGES = "images";
    private static final String CLICKS = "clicks";
    private Bundle bundle;

    public BundleCreator(Bundle bundle) {
        this.bundle = bundle;
    }

    public BundleCreator() {
        bundle = new Bundle();
    }

    public BundleCreator writeCategory(int catId) {
        bundle.putInt(CAT_ID, catId);
        return this;
    }

    public static int readCategory(Bundle bundle) {
        if(bundle != null)
            return bundle.getInt(CAT_ID);
        return -1;
    }

    public BundleCreator writeBonuses(int bonuses) {
        bundle.putInt(BONUSES, bonuses);
        return this;
    }

    public static int readBonuses(Bundle bundle) {
        return bundle.getInt(BONUSES);
    }

    public BundleCreator writePosition(int position) {
        bundle.putInt(POSITION, position);
        return this;
    }

    public static int readPosition(Bundle bundle) {
        return bundle.getInt(POSITION);
    }

    public BundleCreator writeLookId(int lookId) {
        bundle.putInt(LOOK_ID, lookId);
        return this;
    }

    public static int readLookId(Bundle bundle) {
        return bundle.getInt(LOOK_ID);
    }

    public Bundle create() {
        return bundle;
    }

    public static int readClicks(Bundle bundle) {
        return bundle.getInt(CLICKS);
    }

    public BundleCreator writeClicks(int clicks) {
        bundle.putInt(CLICKS, clicks);
        return this;
    }
}
